package com.hyg.module_third_party_demo.activity;

import androidx.appcompat.app.AppCompatActivity;

import android.os.Bundle;
import android.view.View;

import com.alibaba.android.arouter.facade.annotation.Route;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.hyg.lib_common.Base.BaseActivity;
import com.hyg.lib_common.constant.Constants;
import com.hyg.module_third_party_demo.R;
import com.hyg.module_third_party_demo.entity.FastJsonTest;

import java.util.ArrayList;


@Route(path = Constants.PATH_ACTIVITY_MODULE_DEMO_FASTJSON)
public class FastJsonActivity extends BaseActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_fast_json);
    }

    public void onClicked(View view) {
        String json = "{" + "name:" + "\"1123\",\"User\":" + "{\"name\": \"256\",\n" +
                "               \"age\":15,\"boolean\": true}";
        FastJsonTest fastJsonTest = JSON.parseObject(json, FastJsonTest.class);
//      ArrayList<FastJsonTest> list= (ArrayList<FastJsonTest>) JSONArray.parseArray(json,FastJsonTest.class);
    }


}